﻿using OpenApi;
using SuperMoney.Datas.DbModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;

namespace SuperMoney
{
	/// <summary>
	/// 每日赚服务接口。
	/// </summary>
	[ServiceContract(Name = "MeiRiMoney")]
	public interface IMeiRiMoneyService
	{
		/// <summary>
		/// 登陆。
		/// </summary>
		/// <param name="deviceId">设备编号。</param>
		/// <param name="consumerKey">消费者Key。</param>
		/// <param name="device">设备信息。</param>
		/// <returns></returns>
		[OperationContract]
		[WebGet]
		[OpenApiSetting(Openness = ResourceOpenness.Public)]
		LoginResult Login(string deviceId, string consumerKey, string device);

		/// <summary>s
		/// 获取商品列表。
		/// </summary>
		/// <param name="count">每页条数。</param>
		/// <param name="page">当前页码。</param>
		/// <returns></returns>
		[OperationContract(Name = "Commodities")]
		[WebGet]
		[OpenApiSetting(Openness = ResourceOpenness.Public)]
		List<Commodity> GetCommodities(int count, int page);
		
		/// <summary>
		/// 获取积分余额。
		/// </summary>
		/// <param name="deviceId">设备编号。</param>
		/// <returns></returns>
		[OperationContract(Name = "IntegralBalance")]
		[WebGet]
		[OpenApiSetting(Openness = ResourceOpenness.Private, UserIdParameter = "deviceId")]
		int GetIntegralBalance(string deviceId);



		/// <summary>
		/// 兑换商品。
		/// </summary>
		/// <param name="deviceId">设备编号。</param>
		/// <param name="commodityId">商品编号。</param>
		/// <param name="number">兑换数量。</param>
		[OperationContract]
		[WebGet]
		[OpenApiSetting(Openness = ResourceOpenness.Private, UserIdParameter = "deviceId")]
		void ExchangeCommodity(string deviceId, long commodityId, int number, string shipAddress);

		/// <summary>
		/// 获取任务记录。
		/// </summary>
		/// <param name="deviceId">设备编号。</param>
		/// <param name="count">每页条数。</param>
		/// <param name="page">当前页码。</param>
		/// <returns></returns>
		[OperationContract(Name = "TaskRecords")]
		[WebGet]
		[OpenApiSetting(Openness = ResourceOpenness.Private, UserIdParameter = "deviceId")]
		List<TaskRecord> GetTaskRecords(string deviceId, int count, int page);

		/// <summary>
		/// 获取兑换记录。
		/// </summary>
		/// <param name="deviceId">设备编号。</param>
		/// <param name="count">每页条数。</param>
		/// <param name="page">当前页码。</param>
		/// <returns></returns>
		[OperationContract(Name = "ExchangeRecords")]
		[WebGet]
		[OpenApiSetting(Openness = ResourceOpenness.Private, UserIdParameter = "deviceId")]
		List<ExchangeRecord> GetExchangeRecords(string deviceId, int count, int page);

		/// <summary>
		/// 获取特定Key的全局设置项
		/// </summary>
		/// <param name="key">特定Key</param>
		/// <returns></returns>
		[OperationContract(Name = "GSetting")]
		[WebGet]
		GSetting GetGSetting(string key);
	}
}
